<template>
  <div class="model-container">
    <div class="listName">商品管理1</div>
    <!--搜索-->
    <el-card shadow="never">
      <div slot="header" class="clearfix">
        <span>快捷搜索</span>
        <div class="btns-wrapper-right">
          <el-button v-if="!searchShow" icon="el-icon-arrow-down" @click="searchShow = true"/>
          <el-button v-else icon="el-icon-arrow-up" @click="searchShow = false"/>
        </div>
      </div>
      <el-collapse-transition>
        <div v-show="searchShow" class="cardbody">
          <el-form ref="seacherParam" :model="seacherParam">
            <el-row :gutter="10">
              <el-col :xl="5" :lg="6" :md="6" :sm="8" >
                <el-col :xl="7" :lg="7" :md="8" :sm="8" class="input-name">商品名称</el-col>
                <el-col :xl="17" :lg="17" :md="16" :sm="16">
                  <el-form-item prop="">
                    <el-input size="small" placeholder="请输入商品名称"/>
                  </el-form-item>
                </el-col>
              </el-col>
              <el-col :xl="5" :lg="6" :md="6" :sm="8" >
                <el-col :xl="7" :lg="7" :md="8" :sm="8" class="input-name">SKU名称</el-col>
                <el-col :xl="17" :lg="17" :md="16" :sm="16">
                  <el-form-item prop="">
                    <el-input size="small" placeholder="请输入SKU名称"/>
                  </el-form-item>
                </el-col>
              </el-col>
              <el-col :xl="5" :lg="6" :md="6" :sm="8" >
                <el-col :xl="7" :lg="7" :md="8" :sm="8" class="input-name">卖家</el-col>
                <el-col :xl="17" :lg="17" :md="16" :sm="16">
                  <el-form-item prop="">
                    <el-input size="small" placeholder="请输入卖家"/>
                  </el-form-item>
                </el-col>
              </el-col>
              <el-col :xl="5" :lg="6" :md="6" :sm="8" >
                <el-col :xl="7" :lg="7" :md="8" :sm="8" class="input-name">审核状态</el-col>
                <el-col :xl="17" :lg="17" :md="16" :sm="16">
                  <el-form-item prop="">
                    <el-select value="0" placeholder="请选择">
                      <el-option label="全部" value="0"/>
                      <el-option label="是" value="1"/>
                      <el-option label="否" value="2"/>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-col>
            </el-row>
            <div class="cardfooter">
              <el-button type="primary" size="mini" plain @click="seachFun">查询</el-button>
              <el-button type="warning" size="mini" plain @click="resetFun">重置</el-button>
            </div>
          </el-form>
        </div>
      </el-collapse-transition>
    </el-card>
    <!--表格-->
    <el-card style="margin-top: 10px">
      <div slot="header" class="clearfix">
        <div class="btns-wrapper-left">
          <el-button type="primary" plain @click="audit">审核</el-button>
        </div>
      </div>
      <div class="table-wrapper">
        <el-table v-loading="!dataOption" :stripe="true" :data="dataOption" border empty-text="暂无数据">

          <el-table-column align="center" type="selection" width="55"/>

          <el-table-column type="expand">
            <template slot-scope="props">
              <el-form label-position="left" inline>
                <el-form-item label="商品名称">
                  <span>{{ props.row.name }}</span>
                </el-form-item>
                <el-form-item label="所属店铺">
                  <span>{{ props.row.name }}</span>
                </el-form-item>
                <el-form-item label="商品 ID">
                  <span>{{ props.row.name }}</span>
                </el-form-item>
                <el-form-item label="店铺 ID">
                  <span>{{ props.row.name }}</span>
                </el-form-item>
                <el-form-item label="商品分类">
                  <span>{{ props.row.name }}</span>
                </el-form-item>
                <el-form-item label="店铺地址">
                  <span>{{ props.row.address }}</span>
                </el-form-item>
                <el-form-item label="商品描述">
                  <span>{{ props.row.name }}</span>
                </el-form-item>
              </el-form>
            </template>
          </el-table-column>

          <el-table-column align="center" prop="name" label="调库存单ID"/>

          <el-table-column align="center" prop="address" label="商品名称"/>

          <el-table-column align="center" prop="address" label="SKU名称"/>

          <el-table-column align="center" prop="address" label="卖家"/>

          <el-table-column align="center" prop="address" label="调整的库存(件)"/>

          <el-table-column align="center" prop="address" label="原库存(件)"/>

          <el-table-column align="center" prop="address" label="新库存(件)"/>

          <el-table-column align="center" label="审核状态">
            <template slot-scope="scope">{{ scope.row.date }}</template>
          </el-table-column>

          <el-table-column align="center" prop="address" label="审核时间"/>

          <el-table-column align="center" prop="address" label="修改时间"/>

          <el-table-column align="center" label="操作" width="200px">
            <template slot-scope="scope">

              <el-button title="审核" type="primary" circle class="table-icon" @click="audit(scope.row)"><i class="iconfont icon-feiji"/></el-button>

            </template>
          </el-table-column>

        </el-table>

        <!--分页-->
        <el-pagination
          :current-page="pageNo"
          :page-sizes="[10, 20, 30]"
          :page-size="pageSize"
          :total="rowCount"
          background
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"/>
      </div>
    </el-card>

  </div>
</template>

<script>
import * as shop from '../../api/shop'
export default {
  data() {
    return {
      // 页面搜索
      seacherParam: {},
      searchShow: false,
      pageNo: 1,
      pageSize: 10,
      rowCount: 20, // 总条数
      // 弹框
      dialogType: 1, // 1--增加  2--编辑  3--查看
      dialogState: false,
      // 按钮状态
      buttonState: false,
      // 列表数据
      dataOption: [{
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市'
      }],
      // 提交内容
      dialogBindData: {},
      rules: []
    }
  },
  beforeMount() {
    // this.getList();
  },
  methods: {
    seachFun() {

    },
    getList(cb) {
      const param = {
        pageNo: this.pageNo,
        pageSize: this.pageSize
      }
      shop.getLogList(param).then(res => {
        console.log('res', res)
        if (res.data.code !== 1) {
          this.$message.error(res.data.msg)
          return false
        }
        if (res.data.data === 'null' || res.data.data === null) {
          return false
        }
        // 初始话表格数据
        this.dataOption = res.data.data.list
        // 初始化分页数据
        this.rowCount = res.data.data.total
        this.pageSize = res.data.data.pageSize
      })
    },
    // 删除
    audit(data) {
      this.$confirm('是否审核通过', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$message({
          type: 'success',
          message: '删除成功!'
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    },
    // 重置
    resetFun() {
      this.$refs.seacherParam.resetFields()
      this.pageNo = 1
      this.pageSize = 10
      // this.getList()
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
      // this.pageSize = val
      // this.getList()
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`)
      // this.pageNo = val
      // this.getList()
    }
  }
}
</script>
<style type="text/scss" lang="scss" scoped>

</style>
